﻿<%@ Page Language="C#" MasterPageFile="~/BackEnd.master" AutoEventWireup="true" CodeFile="~/Code/Incident.aspx.cs"
    Inherits="Incident" %>

<%@ Register assembly="GMaps" namespace="Subgurim.Controles" tagprefix="cc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="cph_Main" runat="Server">
    <div>
    
    <div style="text-align:center">DMS Backend - Individual Incident Details<br />
        </div>
        <br />
        <br />
        <asp:FormView ID="FormView1" runat="server" 
            DataSourceID="ADS_Incident" Width="100%" OnDataBound="fmview_databound" 
            CellPadding="4" ForeColor="#333333">
            <EditItemTemplate>
                Incident_ID:
                <asp:Label ID="Incident_IDLabel1" runat="server" 
                    Text='<%# Eval("Incident_ID") %>' />
                <br />
                User_ID:
                <asp:TextBox ID="User_IDTextBox" runat="server" Text='<%# Bind("User_ID") %>' />
                <br />
                Description:
                <asp:TextBox ID="DescriptionTextBox" runat="server" 
                    Text='<%# Bind("Description") %>' />
                <br />
                Type:
                <asp:TextBox ID="TypeTextBox" runat="server" Text='<%# Bind("Type") %>' />
                <br />
                Landmark:
                <asp:TextBox ID="LandmarkTextBox" runat="server" 
                    Text='<%# Bind("Landmark") %>' />
                <br />
                City:
                <asp:TextBox ID="CityTextBox" runat="server" Text='<%# Bind("City") %>' />
                <br />
                State_Name:
                <asp:TextBox ID="State_NameTextBox" runat="server" 
                    Text='<%# Bind("State_Name") %>' />
                <br />
                State:
                <asp:TextBox ID="StateTextBox" runat="server" Text='<%# Bind("State") %>' />
                <br />
                Status:
                <asp:TextBox ID="StatusTextBox" runat="server" 
                    Text='<%# Bind("Status") %>' />
                <br />
                Date Reported:
                <asp:TextBox ID="Date_ReportedTextBox" runat="server" 
                    Text='<%# Bind("[Date Reported]") %>' />
                <br />
                Date Resolved:
                <asp:TextBox ID="Date_ResolvedTextBox" runat="server" 
                    Text='<%# Bind("[Date Resolved]") %>' />
                <br />
                <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" 
                    CommandName="Update" Text="Update" />
                &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel" Text="Cancel" />
            </EditItemTemplate>
            <EditRowStyle BackColor="#999999" />
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <InsertItemTemplate>
                User_ID:
                <asp:TextBox ID="User_IDTextBox" runat="server" Text='<%# Bind("User_ID") %>' />
                <br />
                Description:
                <asp:TextBox ID="DescriptionTextBox" runat="server" 
                    Text='<%# Bind("Description") %>' />
                <br />
                Type:
                <asp:TextBox ID="TypeTextBox" runat="server" Text='<%# Bind("Type") %>' />
                <br />
                Landmark:
                <asp:TextBox ID="LandmarkTextBox" runat="server" 
                    Text='<%# Bind("Landmark") %>' />
                <br />
                City:
                <asp:TextBox ID="CityTextBox" runat="server" Text='<%# Bind("City") %>' />
                <br />
                State_Name:
                <asp:TextBox ID="State_NameTextBox" runat="server" 
                    Text='<%# Bind("State_Name") %>' />
                <br />
                State:
                <asp:TextBox ID="StateTextBox" runat="server" Text='<%# Bind("State") %>' />
                <br />
                Status:
                <asp:TextBox ID="StatusTextBox" runat="server" 
                    Text='<%# Bind("Status") %>' />
                <br />
                Date Reported:
                <asp:TextBox ID="Date_ReportedTextBox" runat="server" 
                    Text='<%# Bind("[Date Reported]") %>' />
                <br />
                Date Resolved:
                <asp:TextBox ID="Date_ResolvedTextBox" runat="server" 
                    Text='<%# Bind("[Date Resolved]") %>' />
                <br />
                <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                    CommandName="Insert" Text="Insert" />
                &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel" Text="Cancel" />
            </InsertItemTemplate>
            <ItemTemplate>
                Incident_ID:
                <asp:Label ID="Incident_IDLabel" runat="server" 
                    Text='<%# Eval("Incident_ID") %>' />
                <br />
                User_ID:
                <asp:Label ID="User_IDLabel" runat="server" Text='<%# Bind("User_ID") %>' />
                <br />
                Description:
                <asp:Label ID="DescriptionLabel" runat="server" 
                    Text='<%# Bind("Description") %>' />
                <br />
                Type:
                <asp:Label ID="TypeLabel" runat="server" Text='<%# Bind("Type") %>' />
                <br />
                Landmark:
                <asp:Label ID="LandmarkLabel" runat="server" Text='<%# Bind("Landmark") %>' />
                <br />
                City:
                <asp:Label ID="CityLabel" runat="server" Text='<%# Bind("City") %>' />
                <br />
                State_Name:
                <asp:Label ID="State_NameLabel" runat="server" 
                    Text='<%# Bind("State_Name") %>' />
                <br />
                State:
                <asp:Label ID="StateLabel" runat="server" Text='<%# Bind("State") %>' />
                <br />
                Status:
                <asp:Label ID="StatusLabel" runat="server" 
                    Text='<%# Bind("Status") %>' />
                <br />
                Date Reported:
                <asp:Label ID="Date_ReportedLabel" runat="server" 
                    Text='<%# Bind("[Date Reported]") %>' />
                <br />

                Date Resolved:
                <asp:Label ID="Date_ResolvedLabel" runat="server" 
                    Text='<%# Bind("[Date Resolved]") %>' />
                <br />

            </ItemTemplate>
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
        </asp:FormView>
        <br />
        <asp:Button ID="resolve_btn" runat="server" Text="Resolve this Incident" 
            Visible="False" Width="150px" onclick="resolve_btn_Click" />
        <asp:Button ID="verify_btn" runat="server" Text="Verify this Incident" 
            Visible="False" Width="150px" onclick="verify_btn_Click" />
        <asp:Button ID="deny_btn" runat="server" onclick="deny_btn_Click" 
            Text="Deny this Incident" Visible="False" Width="150px" />
        <br />
        <br />
        <cc1:GMap ID="GMap1" runat="server" Width="100%" BorderColor="Black" 
            BorderStyle="Solid" BorderWidth="1px" />
        <br />
        Outstanding Jobs -
        <asp:Label ID="outstanding_jobs_Label" runat="server"></asp:Label>
        :<br />
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataSourceID="ADS_jobs" Width="100%" style="margin-right: 1px" 
            ondatabound="GridView1_databound" CellPadding="4" ForeColor="#333333" 
            GridLines="None">
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            <Columns>
                <asp:BoundField DataField="Job_ID" HeaderText="Job_ID" InsertVisible="False" 
                    SortExpression="Job_ID" />
                <asp:BoundField DataField="Description" HeaderText="Description" 
                    SortExpression="Description" />
                <asp:CheckBoxField DataField="Job Completed?" HeaderText="Job Completed?" 
                    SortExpression="Job Completed?" />
                <asp:BoundField DataField="Date_Created" HeaderText="Date_Created" 
                    SortExpression="Date_Created" />
                <asp:BoundField DataField="Date_Resolved" HeaderText="Date_Resolved" 
                    SortExpression="Date_Resolved" />
                <asp:BoundField DataField="TeamName" HeaderText="TeamName" 
                    SortExpression="TeamName" />
            </Columns>
            <EditRowStyle BackColor="#999999" />
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#E9E7E2" />
            <SortedAscendingHeaderStyle BackColor="#506C8C" />
            <SortedDescendingCellStyle BackColor="#FFFDF8" />
            <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
        </asp:GridView>
        <asp:Button ID="btn_newJob" runat="server" Text="Create New Job" 
            onclick="btn_newJob_Click" />
        <br />
        <br />
        Completed Jobs - 
        <asp:Label ID="completed_jobs_label" runat="server"></asp:Label>
        :<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" CellPadding="4"
            DataSourceID="ADS_jobs_completed" ForeColor="#333333" GridLines="None" Width="100%"
            OnDataBound="GridView2_databound">
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            <Columns>
                <asp:BoundField DataField="Job_ID" HeaderText="Job_ID" InsertVisible="False" 
                    SortExpression="Job_ID" />
                <asp:BoundField DataField="Description" HeaderText="Description" 
                    SortExpression="Description" />
                <asp:CheckBoxField DataField="Job Completed?" HeaderText="Job Completed?" 
                    SortExpression="Job Completed?" />
                <asp:BoundField DataField="Date_Created" HeaderText="Date_Created" 
                    SortExpression="Date_Created" />
                <asp:BoundField DataField="Date_Resolved" HeaderText="Date_Resolved" 
                    SortExpression="Date_Resolved" />
                <asp:BoundField DataField="TeamName" HeaderText="TeamName" 
                    SortExpression="TeamName" />
            </Columns>
            <EditRowStyle BackColor="#999999" />
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#E9E7E2" />
            <SortedAscendingHeaderStyle BackColor="#506C8C" />
            <SortedDescendingCellStyle BackColor="#FFFDF8" />
            <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
        </asp:GridView>
        <br />
        <asp:AccessDataSource ID="ADS_jobs_completed" runat="server" 
            DataFile="~/App_Data/Database.accdb" 
            SelectCommand="SELECT Jobs.Job_ID, Jobs.Description, Jobs.[Job Completed?], Jobs.[Date Created] AS Date_Created, Jobs.[Date Resolved] AS Date_Resolved, Teams.TeamName FROM (Jobs INNER JOIN Teams ON Jobs.[Assigned Team] = Teams.Team_ID) WHERE (Jobs.Incident_ID = ?) AND (Jobs.[Job Completed?] = True)">
            <SelectParameters>
                <asp:QueryStringParameter DefaultValue="" Name="?" QueryStringField="id" />
            </SelectParameters>
        </asp:AccessDataSource>
        
        <asp:AccessDataSource ID="ADS_Incident" runat="server" 
            DataFile="~/App_Data/Database.accdb" 
            
            SelectCommand="SELECT Incidents.Incident_ID, Incidents.User_ID, Incidents.Description, Incidents.Type, Incidents.Landmark, Incidents.City, State.State_Name, Incidents.State, Incidents.Status, Incidents.[Date Reported], Incidents.[Date Resolved] FROM (Incidents INNER JOIN State ON Incidents.State = State.State_ID) WHERE (Incidents.Incident_ID = ?)">
            <SelectParameters>
                <asp:QueryStringParameter Name="Incident_ID" QueryStringField="id" 
                    Type="Int32" DefaultValue="1" />
            </SelectParameters>
        </asp:AccessDataSource>
        <asp:AccessDataSource ID="ADS_jobs" runat="server" 
            DataFile="~/App_Data/Database.accdb" 
            
            
            SelectCommand="SELECT Jobs.Job_ID, Jobs.Description, Jobs.[Job Completed?], Jobs.[Date Created] AS Date_Created, Jobs.[Date Resolved] AS Date_Resolved, Teams.TeamName FROM (Jobs INNER JOIN Teams ON Jobs.[Assigned Team] = Teams.Team_ID) WHERE (Jobs.Incident_ID = ?) AND (Jobs.[Job Completed?] = False)">
            <SelectParameters>
                <asp:QueryStringParameter Name="Incident_ID" QueryStringField="id" 
                    Type="Int32" />
            </SelectParameters>
        </asp:AccessDataSource>

</asp:Content>
